package de.tabuma.formcreator.entity;

/**
  * @author $Author: $
  * @version $Revision: $
  * @since $Date: $
 */
public class FormElement extends FormType {

    private static Long counter = new Long(1);

    public FormElement(String type,String name,String beschreibung,String value,boolean attribute) {
        super(type);
        this.name = name.replaceAll("_", " ");
        this.description = beschreibung;
        this.value = value;
        this.attribute = attribute;
        this.id = counter;
        counter = new Long(counter+1);
    }

    private long id;
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }

    private String value;
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }

    private boolean attribute;
    public boolean isAttribute() {
        return attribute;
    }
    public void setAttribute(boolean attribute) {
        this.attribute = attribute;
    }

    private String description;
    public String getDescription() {
        return description;
    }
    public void setDescription(String beschreibung) {
        this.description = beschreibung;
    }
    public String getDescriptionWithoutSpecialCharacter() {
        String strDescription = this.description;
        strDescription = strDescription.replaceAll("\n", "");
        strDescription = strDescription.replaceAll("\t", "");
        return strDescription;
    }

    private String name;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getXMLName() {
        return this.name.replace(" ", "_");
    }
}